[DllImport("kernel32.dll", SetLastError=true, CharSet=CharSet.Auto)]
static extern bool GetComputerNameEx(COMPUTER_NAME_FORMAT NameType,
[Out] StringBuilder lpBuffer, ref uint lpnSize);
None.
Please add some!
Please add some!
class Class1
{
enum COMPUTER_NAME_FORMAT
{
ComputerNameNetBIOS,
ComputerNameDnsHostname,
ComputerNameDnsDomain,
ComputerNameDnsFullyQualified,
ComputerNamePhysicalNetBIOS,
ComputerNamePhysicalDnsHostname,
ComputerNamePhysicalDnsDomain,
ComputerNamePhysicalDnsFullyQualified
}
[DllImport("kernel32.dll", SetLastError=true, CharSet=CharSet.Auto)]
static extern bool GetComputerNameEx(COMPUTER_NAME_FORMAT NameType,
[Out] StringBuilder lpBuffer, ref uint lpnSize);
[STAThread]
static void Main(string[] args)
{
bool success;
StringBuilder name = new StringBuilder(260);
uint size = 260;
success = GetComputerNameEx(COMPUTER_NAME_FORMAT.ComputerNameDnsDomain,name, ref size);
Console.WriteLine(name.ToString());
}
}
Do you know one? Please contribute it!